﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CustomMapinfoWindows.ViewModels
{
    public class DriveViewModel : TreeViewItemViewModel, IHasPath
    {
        public DriveViewModel(string drivename,ComputerViewModel fileExpolorer)
            : base(fileExpolorer,true)
        {
            this.Name = drivename;
            this.FullPath = drivename;
        }

        public string Name { get; set; }

        public string FullPath { get; set; }

        protected override void LoadChildren()
        {
                foreach (string dir in Directory.GetDirectories(this.FullPath))
                {
                    try
                    {
                        DirectoryViewModel dirvm = new DirectoryViewModel(dir, this);
                        dirvm.IsWatchedForChanges = true;
                        base.Children.Add(dirvm);
                    }
                    catch (Exception)
                    {
                        
                        throw;
                    }
                    
                }           
        }

    }
}
